const mysql = require('mysql')
var exports = module.exports

exports.operationalDatabase = function(sql,callback) {
	// 创建mysql连接
	const connection = mysql.createConnection({
		host:'127.0.0.1',
		port:3306,
		user:'root',
		password:'1234',
		database:'uniapp'
	})
	connection.connect();
	 connection.query(sql,(err,res)=>{
		if(err){
			console.log(err);
			return
		}
		callback(res)
		connection.destroy()
	})
}